import request from "@/utils/request";

// 角色模块URL
const ROLE_BASE_URL = "/admin";

const RoleAPI = {
    /**
     * 获取角色列表
     * @param queryParams
     * @returns
     */
    getList(queryParams: any) {
        return request<any, any>({
            url: `${ROLE_BASE_URL}/userType/list`,
            method: "get",
            params: queryParams,
        });
    },

    /**
     * 添加角色
     * @param
     * @returns
     */
    addRole(params: any) {
        return request<any, any>({
            url: `${ROLE_BASE_URL}/userType/add`,
            method: "post",
            params: params,
        });
    },

    /**
     * 获取角色详情
     * @param
     * @returns
     */
    getRoleInfo(id: any) {
        return request<any, any>({
            url: `${ROLE_BASE_URL}/userType/info?id=1`,
            method: "get",
            params: { id },
        });
    },

    /**
     * 编辑用户详情
     * @param
     * @returns
     */
    editRoleInfo(params: any) {
        return request<any, any>({
            url: `${ROLE_BASE_URL}/userType/edit`,
            method: "post",
            params: params,
        });
    },

    /**
     * 查看角色详情
     * @param
     * @returns
     */
    viewRoleInfo(id: any) {
        return request<any, any>({
            url: `${ROLE_BASE_URL}/userType/detail`,
            method: "get",
            params: id,
        });
    },

    /**
     * 修改角色编辑状态
     * @param
     * @returns
     */
    changeRoleStatus(params: any) {
        return request<any, any>({
            url: `${ROLE_BASE_URL}/userType/updateStatus`,
            method: "post",
            params: params,
        });
    },
};

export default RoleAPI;
